﻿package mortal.game.view.guild.cellrender
{
    import Message.Public.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class GuildApplyListCellRenderer extends GuildCellRenderer
    {
        private var _bmpVip:GBitmap;
        private var _txtPlayerName:GTextFiled;
        private var _txtLevel:GTextFiled;
        private var _txtCareer:GTextFiled;
        private var _txtFightPower:GTextFiled;
        private var _btnAgree:GLoadedButton;
        private var _btnReject:GLoadedButton;
        private var _saveData:SMiniPlayer;

        public function GuildApplyListCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            var _loc_1:* = GlobalStyle.textFormatPutong;
            _loc_1.align = "center";
            this._txtPlayerName = UIFactory.gTextField("", 40, 3, 100, 20, this);
            this._txtLevel = UIFactory.gTextField("lv.11", 168, 3, 40, 20, this);
            this._txtCareer = UIFactory.gTextField("", 256, 3, 60, 20, this);
            this._txtFightPower = UIFactory.gTextField("100000", 320, 3, 80, 20, this, _loc_1);
            this._btnAgree = UIFactory.gLoadedButton("GroupBtn_upSkin", 440, 1.5, 38, 22, this);
            this._btnAgree.label = Language.getString(60070);
            this._btnAgree.configEventListener(MouseEvent.CLICK, this.onMouseClick);
            this._btnReject = UIFactory.gLoadedButton("GroupBtn_upSkin", 483, 1.5, 38, 22, this);
            this._btnReject.label = Language.getString(60071);
            this._btnReject.configEventListener(MouseEvent.CLICK, this.onMouseClick);
            UIFactory.bg(0, 25, 530, 1, this, ImagesConst.SplitLine);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_2:* = param1 as SMiniPlayer;
            this._saveData = _loc_2;
            this._txtPlayerName.text = _loc_2.name;
            this._txtLevel.text = "lv." + _loc_2.level;
            this._txtFightPower.text = _loc_2.combat.toString();
            this._txtCareer.text = GameDefConfig.instance.getItem("ECareer", _loc_2.career).text;
            if (_loc_2.online)
            {
                var _loc_3:* = GuildUtil.MemberOnlineColor;
                this._txtCareer.textColor = GuildUtil.MemberOnlineColor;
                var _loc_3:* = _loc_3;
                this._txtFightPower.textColor = _loc_3;
                var _loc_3:* = _loc_3;
                this._txtLevel.textColor = _loc_3;
                this._txtPlayerName.textColor = _loc_3;
            }
            else
            {
                var _loc_3:* = GuildUtil.MemberOfflineColor;
                this._txtCareer.textColor = GuildUtil.MemberOfflineColor;
                var _loc_3:* = _loc_3;
                this._txtFightPower.textColor = _loc_3;
                var _loc_3:* = _loc_3;
                this._txtLevel.textColor = _loc_3;
                this._txtPlayerName.textColor = _loc_3;
            }
            return;
        }// end function

        protected function onMouseClick(event:MouseEvent) : void
        {
            var _loc_2:Object = null;
            switch(event.target)
            {
                case this._btnAgree:
                {
                    _loc_2 = new Object();
                    _loc_2.playerID = this._saveData.entityId.id;
                    _loc_2.agree = true;
                    _loc_2.handleAll = false;
                    Dispatcher.dispatchEvent(new DataEvent(EventName.GUILD_DEAL_APPLY, _loc_2));
                    break;
                }
                case this._btnReject:
                {
                    _loc_2 = new Object();
                    _loc_2.playerID = this._saveData.entityId.id;
                    _loc_2.agree = false;
                    _loc_2.handleAll = false;
                    Dispatcher.dispatchEvent(new DataEvent(EventName.GUILD_DEAL_APPLY, _loc_2));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

    }
}
